home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 176-200 / 179 / tsnip / menu.c < prev    next >
C/C++ Source or Header  |  1995-03-13  |  2KB  |  85 lines

  1.  
  2. /* gosh, this goes way way way back, one of my very first Amiga programs...
  3.  
  4.    John Russell */
  5.  
  6. /* include all the standard stuff for intuition */
  7.  
  8. #include "intuition/intuitionbase.h"
  9.  
  10. struct IntuitionBase *IntuitionBase;
  11.  
  12. _cli_parse() {}
  13. _wb_parse() {}
  14. _abort() {}
  15.  
  16. main()
  17. {
  18.     register struct Screen *screen;
  19.     register struct Window *window;
  20.     register struct MenuItem *menuitem;
  21.     register struct Menu *menu;
  22.     register long ILock;
  23.  
  24.     if ((IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0L))==NULL)
  25.     {
  26.             printf("Where is Intuition gone???\n");
  27.             exit(10);
  28.     }
  29.  
  30.     Forbid();
  31.  
  32.     screen = IntuitionBase->FirstScreen;
  33.  
  34.     printf("First screen title is \"%s\".\n",screen->Title ? screen->Title :
  35.         "<NULL>");
  36.  
  37.     do_windows(screen);
  38.  
  39.     while (screen->NextScreen != NULL) {
  40.         screen = screen->NextScreen;
  41.         printf("Another screen is titled \"%s\".\n",screen->Title ? screen->Title
  42.             : "<NULL>");
  43.         do_windows(screen);
  44.     }
  45.  
  46.     printf("No more screens.\n");
  47.  
  48.     Permit();
  49.  
  50.     CloseLibrary(IntuitionBase);
  51.  
  52. }
  53.  
  54. do_windows(screen)
  55. register struct Screen *screen;
  56. {
  57.     register struct Window *window;
  58.  
  59.     window = screen->FirstWindow;
  60.     printf("\tThe first window is titled \"%s\".\n",window->Title ? window->Title
  61.         : "<NULL>");
  62.     do_menus(window->MenuStrip);
  63.  
  64.     while (window->NextWindow != NULL) {
  65.         window = window->NextWindow;
  66.         printf("\tAnother window title is \"%s\".\n",window->Title ? window->Title
  67.             : "<NULL>");
  68.         do_menus(window->MenuStrip);
  69.     }
  70.  
  71.     printf("\tNo more windows.\n");
  72. }
  73.  
  74. do_menus(menu)
  75. register struct Menu *menu;
  76. {
  77.     while (menu != NULL) {
  78.         printf("\t\tMenu title: \"%s\".\n",menu->MenuName ? menu->MenuName :
  79.             "<NULL");
  80.         menu = menu->NextMenu;
  81.     }
  82.     printf("\t\tNo more menus.\n");
  83. }
  84.  
  85.